package sub1;

import java.io.Serializable;
import java.net.InetAddress;

/**
 * Define the structure of our clients. A client has a own inetAddress and a own port.
 * @author Magali Moulin, Pierre Labiausse
 * @version 1
 */
public class ClientTcpTuple implements Serializable{
	
	private InetAddress inetAddress;
	private int port;
	
	/**
	 * Constructor of this class
	 * @param inetAddress: address of the client 
	 * @param port: port of the client
	 */
	public ClientTcpTuple(InetAddress inetAddress, int port){
		this.inetAddress=inetAddress;
		this.port=port;
	}
	
	@Override
	public boolean equals(Object arg0) {
		if (!(arg0 instanceof ClientTcpTuple)){
			return false;
		}
		else {
			return(
					this.inetAddress.equals(((ClientTcpTuple)arg0).getInetAddress())
					&&this.port==((ClientTcpTuple)arg0).getPort()
					);
		}
			
	}

	/**
	 * Getter to have access to the address of the client
	 * @return inetAddress, address of the client
	 */
	public InetAddress getInetAddress() {
		return inetAddress;
	}
	
	/**
	 * Getter to have access to the port of the client
	 * @return port, port of the client
	 */
	public int getPort() {
		return port;
	}
	
	
	
}
